package control;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FabricaFechas {

	public static String formatear(Date date) {
		SimpleDateFormat sdf = new SimpleDateFormat("EEEEEEEEEE, d 'de' MMMMMMMMMMMM 'de' yyyy");
		return sdf.format(date);
	}

	private static String hora() {
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
		return sdf.format(new Date());
	}

	private static String fecha() {
		SimpleDateFormat sdf = new SimpleDateFormat("EEEEEEEEEE, d 'de' MMMMMMMMMMMM 'de' yyyy");
		return sdf.format(new Date());
	}

	public static String obtenerFechaHora() {
		return crearFecha() + ": ";
	}

	public static String obtenerHora() {
		return hora() + ": ";
	}

	public static String obtenerFecha() {
		return fecha() + ": ";
	}

	public static String obtenerFechaInforme() {
		return fecha();
	}

	public static String crearFecha() {
		return fecha() + " " + hora();
	}

	public static int diferenciaDias(Date d1, Date d2) {
		long difms = Math.abs(d2.getTime() - d1.getTime());
		long difd = difms / (1000 * 60 * 60 * 24);
		return (int) difd;
	}
}
